package pl.edu.agh.mgr.hotel.ws;

import java.util.HashSet;

import javax.jws.WebService;

import org.hibernate.Session;

import pl.edu.agh.mgr.hotel.entities.Hotel;
import pl.edu.agh.mgr.hotel.entities.ServiceDescription;
import pl.edu.agh.mgr.hotel.entities.Street;
import pl.edu.agh.mgr.hotel.hibernate.HibernateUtil;
import pl.edu.agh.mgr.hotel.ws.data.DataRequest;
import pl.edu.agh.mgr.hotel.ws.data.DataResponse;

@WebService(targetNamespace = "http://ws.hotel.mgr.agh.edu.pl/", portName = "DataServicePort", serviceName = "DataServiceService")
public class DataService {
	private ServiceDescription serviceDescription = new ServiceDescription();

	public DataResponse getHotelData(DataRequest dataRequest) {

		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		session.save(new Street("Staszica"));
		session.getTransaction().commit();

		return new DataResponse("WSResponse : " + dataRequest.getName(), new Hotel(), 
				new HashSet<ServiceDescription>());
	}
}
